<?php
/**
 * 注：此模板为自动生成模板，需要根据实际情况调整修改
 * 此模板对 无主键/单一主键 表的支持较好，联合主键表在下一版本开发
 */
namespace Data;

use Utils\MyException;

class Tree_verify_code {

    //数组
    private $array;


    public function __construct ($array){

        $this->array = $array;

        self::setDefault();

    }

    public function getArray() {
        return $this->array;
    }

    public function updateWithArray($array) {
        foreach($array as $key=>$value)
        {
            if(array_key_exists($key,$this->array))
            {
                $this->array = array_merge($this->array,array($key=>$value));
            }
        }
    }



    private function setDefault(){

        if(count($this->array)==0){
            self::setCODE_ID("null");
            self::setPHONE_NUMBER("");
            self::setVERIFY_CODE("");
            self::setVERIFY_CODE_TIME("");

        }
    }






    public function setCODE_ID($value) {
        $this->array = array_merge ($this->array,array(
            'CODE_ID' => $value));
    }
    public function getCODE_ID(){

        return $this->array ['CODE_ID'];
    }


    public function setPHONE_NUMBER($value) {
        $this->array = array_merge ($this->array,array(
            'PHONE_NUMBER' => $value));
    }
    public function getPHONE_NUMBER(){

        return $this->array ['PHONE_NUMBER'];
    }


    public function setVERIFY_CODE($value) {
        $this->array = array_merge ($this->array,array(
            'VERIFY_CODE' => $value));
    }
    public function getVERIFY_CODE(){

        return $this->array ['VERIFY_CODE'];
    }


    public function setVERIFY_CODE_TIME($value) {
        $this->array = array_merge ($this->array,array(
            'VERIFY_CODE_TIME' => $value));
    }
    public function getVERIFY_CODE_TIME(){

        return $this->array ['VERIFY_CODE_TIME'];
    }


    public function toInsertCSV() {
        $str="";

        // CODE_ID
        $str .= self::getCODE_ID().",";
        // PHONE_NUMBER
        $str .= "'". self::getPHONE_NUMBER()."',";
        // VERIFY_CODE
        $str .= "'". self::getVERIFY_CODE()."',";
        // VERIFY_CODE_TIME
        $str .= "'". self::getVERIFY_CODE_TIME()."'";
        return $str;
    }



    public function toUpdateSet() {
        $str="";

        // PHONE_NUMBER
        $str.= '`PHONE_NUMBER` = "' . self::getPHONE_NUMBER() . '",';

        // VERIFY_CODE
        $str.= '`VERIFY_CODE` = "' . self::getVERIFY_CODE() . '",';

        // VERIFY_CODE_TIME
        $str.= '`VERIFY_CODE_TIME` = "' . self::getVERIFY_CODE_TIME(). '"';
        return $str;
    }



    public function toUpdateWhere(){
        $str = "";
        $str .= "`CODE_ID` = '" . self::getCODE_ID()."'";
        return $str;
    }

}


